﻿#pragma once

#include "Common.h"

// 线程的专属内存池池
class ThreadCache
{
public:
	// 申请释放内存
	void* Allocate(size_t size);
	void Deallocate(void* ptr, size_t size);
	void* FetchFromCentralCache(size_t index, size_t size);
	void ListTooLong(FreeList& list, size_t size);

private:
	FreeList _freeLists[NFREE_LISTS];
};

// TLS:thread local storage
static _declspec(thread) ThreadCache* tlsThreadCache = nullptr;